package cn.linstudy.web.controller;

import cn.linstudy.common.web.Result;
import cn.linstudy.domain.SeckillProduct;
import cn.linstudy.domain.SeckillProductVo;
import cn.linstudy.service.ISeckillProductService;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/seckillProduct")
@Slf4j
public class SeckillProductController {
    @Autowired
    private ISeckillProductService seckillProductService;


    @RequestMapping("/querySeckillProductVOSByTime")
    Result<List<SeckillProductVo>> querySeckillProductVOSByTime(int time){
        return seckillProductService.querySeckillProductVOSByTime(time);
    }

    @RequestMapping("/queryByTime")
    Result<List<SeckillProductVo>> queryByTime(@RequestParam("time") String time){
        return seckillProductService.queryByTime(Integer.parseInt(time));
    }

    @RequestMapping("/find")
    Result<SeckillProductVo> find(String time,String seckillId){
        return seckillProductService.find(Integer.parseInt(time),Long.parseLong(seckillId));
    }
}
